package com.jar.exercise.网络编程.ipDemo;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 192.168.234.1
 * 松鼠
 */
public class IPDemo {
	public static void main(String[] args) throws UnknownHostException {
		InetAddress byName = InetAddress.getLocalHost();
		InetAddress byName1 = InetAddress.getByName("www.baidu.com");
		System.out.println(byName1.getHostName());
		System.out.println(byName1.getHostAddress());


		System.out.println(byName.getHostAddress());
		System.out.println(byName.getHostName());

	}
}
